package com.xbdun.service.bmp.facade;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.xbdun.common.exceptions.BizException;
import com.xbdun.facade.bmp.request.system.PlatformRequest;
import com.xbdun.facade.bmp.response.system.PlatformResponse;
import com.xbdun.facade.bmp.service.system.PlatfromFacade;
import com.xbdun.service.bmp.service.system.PlatfromService;

import lombok.extern.slf4j.Slf4j;

@Component
@Slf4j
public class PlatfromFacadeImpl implements PlatfromFacade{

	@Autowired
	PlatfromService secretService;

	public PlatformResponse getSecretVal(PlatformRequest request) {
		PlatformResponse result = null;
		try{
			if(null ==  request.getPlatCode()|| request.getPlatCode().intValue()<=0){
				throw BizException.PARAM_CHKE_FAIL.newInstance("应用平台的编号不合法["+request.getPlatCode()+"]");
			}
			result = secretService.getSecretVal(request);
		}catch(Exception e){
			log.error("根据应用平台编号["+request.getPlatCode()+"]查询应用编号的密钥，异常:{}",e);
		}
		return result;
	}
}
